Generate all permutations ​
Generate all permutations — LeetCode
Given an array of distinct integers, return all of its possible permutations.
Approach ​
Keep an array of bools. Recursively add each element at each place, and then remove it back.
Recursively swap each element with another element
Remarks ​
https://youtu.be/YK78FU5Ffjw?si=xYREhnkHuvGhzRV
https://youtu.be/f2ic2Rsc9pU?si=SThfc2gGbxqXo1Rn